<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<!-- <style>
    .box{
        width: 100px;
    }
</style> -->

<body>
    <div id="app">
        <div v-show="flag" class="box">v-show</div>
        <div v-if="flag" class="box">v-if</div>

        <!-- v-show的底层原理是：切换css的display：none 来控制显示隐藏的 -->
        <!-- v-if的底层原理：根据判断条件控制元素的创建和移除元素节点（直接没有） -->
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                flag: false,
            }
        })
    </script>

</body>

</html>